#ifndef OPENFILE_H
#define OPENFILE_H
#include <QString>
#include <QDir>
#include <QDebug>
#include <qdiriterator.h>
//#include <QMap>

#include "viewer.h"

class SendFile
{
public:
    SendFile(QString filename);
    ~SendFile();
    int Openfiles(QByteArray &filename , QByteArray &data, int file_num);
    void FileDataSave();

    QString     m_directory;
    QString     m_file;
    QByteArray  m_data;
    int     m_size;
private:
};

class File
{
public:
    File(QString data);
    File(QByteArray data);

    void AnalyseRawData();

    void WriteFile();
    void CreateDir();
    QString m_raw_data;
private:
    QString m_adress;
    QString m_name;
    QByteArray m_data;
    QDir m_current_dir;
    QString m_current_file;
};

extern QString Dir2Name(QString root_dir,QString file_dir);
extern void writeBinaryDataToFile(const QString &filePath, const QByteArray &data);
#endif // OPENFILE_H


